package ru.demo.abstarctservice.adapter.mapper;

import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import ru.demo.abstarctservice.entity.BaseEntity;

import java.util.List;

public interface AbstractMapper<Entity extends BaseEntity, Dto> {

    List<Dto> mapListToDto(List<Entity> entity);

    Dto mapToDto(Entity entity);

    @Mapping(target = "id", ignore = true)
    Entity mapFromDto(Dto dto);

    @Mapping(target = "id", ignore = true)
    Entity updateEntity(Entity newEntity, @MappingTarget Entity oldEntity);

}
